{# Reusable search/filter header for template list pages #}
{# Usage: {% include 'assets/partials/search_card.html' with search_query=search_query %} #}
{# Optional flags: show_export (default true), show_create (default true) #}

<div class="search-card">
    <div class="row align-items-center">
        <div class="col-md-8">
            <form method="get" class="d-flex">
                <input type="text" class="form-control me-2" name="search"
                       value="{{ search_query }}" placeholder="搜索模板名称或描述...">
                <button type="submit" class="btn btn-primary">
                    <i class="fas fa-search"></i>
                </button>
            </form>
        </div>
        <div class="col-md-4 text-end">
            {% if show_export|default:True %}
            <div class="btn-group me-2" role="group">
                <button type="button" class="btn btn-outline-secondary btn-custom dropdown-toggle" data-bs-toggle="dropdown">
                    <i class="fas fa-download me-1"></i>导出
                </button>
                <ul class="dropdown-menu">
                    <li><a class="dropdown-item" href="#" onclick="exportTemplates('user')">
                        <i class="fas fa-user me-2"></i>我的模板
                    </a></li>
                    <li><a class="dropdown-item" href="#" onclick="exportTemplates('all')">
                        <i class="fas fa-globe me-2"></i>所有公共模板
                    </a></li>
                </ul>
            </div>
            {% endif %}
            {% if show_create|default:True %}
            <button type="button" class="btn btn-success btn-custom" data-bs-toggle="modal" data-bs-target="#createTemplateModal">
                <i class="fas fa-plus me-2"></i>新建模板
            </button>
            {% endif %}
        </div>
    </div>
</div>
